package cn.blnp.net.flowable.boot.service.impl;

import cn.blnp.net.flowable.boot.ext.cmd.TaskRecallCmd;
import cn.blnp.net.flowable.boot.service.TaskRecallService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.ManagementService;
import org.springframework.stereotype.Service;

/**
 * <h3>任务撤回服务接口</h3>
 *
 * @author <a href="mailto:blnp.yibin@qq.com">lyb</a>
 * @version 1.0
 * @since 2025/6/19 9:28
 */
@Slf4j
@Service
@AllArgsConstructor
public class TaskRecallServiceImpl implements TaskRecallService {

    protected ManagementService managementService;

    @Override
    public void executeRecall(String taskId) {
        //实例化撤回Command类
        TaskRecallCmd taskRecallCmd = new TaskRecallCmd(taskId);
        //通过ManagementService管理服务执行撤回Command类
        managementService.executeCommand(taskRecallCmd);
    }
}
